<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/client/adapt.jsp"%>
<% 		String conts = aa.getReqParameterValue("receiver"); 
        String []cont = conts.split(":");
        String type = cont[0];
        String params [] = cont[1].split(",");	
        String clientid = aa.getReqParameterValue("clientid"); 
        System.out.println("============"+clientid);
		String directPushType = aa.getReqParameterValueFromUrl("directPushType");
		String imm = aa.getReqParameterValueFromUrl("imm");	
		String msg = aa.getReqParameterValueFromUrl("msg");		
%>
<%-- directPushType:app,本应用的直推消息，收到后打开page/page1.html页面，透传参数 id、name --%>
<%-- immediately：是否后续操作立刻执行，1标示该消息的后续操作立刻执行，0标示用户点击后执行page：用户点击后打开的本地页面。此参数PC、android有效 --%>
<%-- page:directPushType=app时有效,用户点击后打开的本地页面page1.xhtml --%>
<%if(directPushType.equals("app")){ %>
    <aa:direct-push directPushType="app"
	titleHead="新消息" title="您收到直推消息" immediately="<%=imm %>" page="page/page1.xhtml">
	<%for(int i=0;i<params.length;i++){   %>
       <aa:choose>
       		<%-- 根据esn发送 --%>
       		<aa:when test='<%="esn".equals(type)%>'>
       			<aa:push-receiver clientid='<%=clientid%>' esn="<%=params[i]%>"/>
       		</aa:when>
       		<%-- 根据imsi发送 --%>
       		<aa:when test='<%="imsi".equals(type)%>'>
       			<aa:push-receiver clientid='<%=clientid%>' imsi="<%=params[i]%>"/>
       		</aa:when>
       		<aa:otherwise>  
       		</aa:otherwise>
       </aa:choose>      
   <% }%> 
	<%-- 指定直推页面参数列表，page1.xhtml页面需要的参数 --%>
	<aa:push-params>
		<aa:push-param name="param1" value="param1" />
		<aa:push-param name="param2" value='param2' />
		<aa:push-param name="param3" value='<%=msg %>' />
	</aa:push-params>
</aa:direct-push>

<%}else{ %>
    <%-- directPushType:notify 通知消息，无后续操作，打开基座也无需进入消息列表界面 --%>
    <aa:direct-push directPushType="notify"
	titleHead="新消息" title="<%=msg %>" >
	<%for(int i=0;i<params.length;i++){ 
   %>
       <aa:choose>
       		<aa:when test='<%="esn".equals(type)%>'>
       			<aa:push-receiver clientid='<%=aa.getReqParameterValue("clientid")%>' esn="<%=params[i]%>"/>
       		</aa:when>
       		<aa:when test='<%="imsi".equals(type)%>'>
       			<aa:push-receiver clientid='<%=aa.getReqParameterValue("clientid")%>' imsi="<%=params[i]%>"/>
       		</aa:when>
       		<aa:otherwise>   
       		</aa:otherwise>
       </aa:choose>      
   <% }%> 	
</aa:direct-push>
<%} %>

